package com.foreverwin.jzymes.framework.websocket;

import com.alibaba.fastjson.JSONObject;
import com.foreverwin.jzymes.framework.event.AppEvent;
import org.eclipse.jetty.websocket.WebSocket;
import org.springframework.context.ApplicationListener;

import java.util.List;

public interface TextMessageWebSocket extends WebSocket.OnTextMessage, ApplicationListener<AppEvent<?>> {

    public String getChannel();

    public void setChannel( String channel );

    public void doAfterOpen( Connection connection );

    public void doAfterClose();

    public JSONObject doReceiveAndReply(String messageType, JSONObject requestParams );

    public void sendMessage( String message );

    public void publishMessage( String message );

    public void onAppEvent(AppEvent<?> appEvent);

    public List<String> getEvents();

}
